﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AspValidation
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (this.gendreDynamic.Attributes["onchange"] == null)
            //{
            //    this.gendreDynamic.Attributes.Add("onchange", "javascript:GendreChanged(this)");
            //}
        }

        protected void custom_ServerValidate(object sender, ServerValidateEventArgs e)
        {
            if (this.iAcceptCheckBox.Checked)
            {
                e.IsValid = true;
            }
            else
            {
                e.IsValid = false;
            }
        }

        protected void submitBtn_Click(object sender, EventArgs e)
        {
            Page.Validate("Personal");
            Page.Validate("Address");
            Page.Validate("Logon");

            Response.Write(Page.IsValid);
        }

        protected void Gender_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.Gender.SelectedValue == "Male")
            {
                this.femalePanel.Visible = false;
                this.malePanel.Visible = true;
            }
            else
            {
                this.malePanel.Visible = false;
                this.femalePanel.Visible = true;
            }
        }
    }
}